<template>
  <div style="  padding-top: 50px;padding-left: 50px;">

    <!--  售前被分配客户 -->
    <!--  todo:  v-has-role="['salesman']" -->
    <div v-if="distNum>0" style="padding-bottom: 20px">
      <span>您还有 {{ distNum }} 位客户待跟进，</span>
      <el-link style="font-size: 17px;margin-top: -6px" type="primary" @click="jump('myPreSale',1)">
        点击处理
      </el-link>
    </div>

    <!-- boss确认售前转后期 -->
    <!-- todo: v-has-role="['boss']"  -->
    <div v-if="loanToNum>0" style="padding-bottom: 20px">
      <span>有 {{ loanToNum }} 条售前转后期记录需要您确认，</span>
      <el-link style="font-size: 17px;margin-top: -6px" type="primary" @click="jump('confirmLaterPeriod',2)">
        点击处理
      </el-link>
    </div>

    <!-- 后期被分配客户 -->
    <!-- todo: v-has-role="['later_period']"  -->
    <div v-if="loanNum>0" style="padding-bottom: 20px">
      <span>您还有 {{ loanNum }} 位客户待跟进，</span>
      <el-link style="font-size: 17px;margin-top: -6px" type="primary" @click="jump('myLaterPeriod',3)">
        点击处理
      </el-link>
    </div>

    <!-- boss确认后期转售后 -->
    <!-- todo: v-has-role="['boss']"  -->
    <div v-if="afterToNum>0" style="padding-bottom: 20px">
      <span>有 {{ afterToNum }} 条后期转售后记录需要您确认，</span>
      <el-link style="font-size: 17px;margin-top: -6px" type="primary" @click="jump('confirmAfterSale',4)">
        点击处理
      </el-link>
    </div>

    <!-- 售后被分配客户 -->
    <!-- todo: v-has-role="['after_sale']"  -->
    <div v-if="afterNum>0" style="padding-bottom: 20px">
      <span>您还有 {{ afterNum }} 位客户待跟进，</span>
      <el-link style="font-size: 17px;margin-top: -6px" type="primary" @click="jump('myAfterSale',5)">
        点击处理
      </el-link>
    </div>

    <!-- 客户生日、客户配偶生日、结婚纪念日提醒 -->
    <!-- todo: v-has-role="['after_sale']"  -->
    <div v-if="birthdayNum>0" style="padding-bottom: 20px">
      <span>您还有 {{ birthdayNum }} 位客户生日、客户配偶生日、结婚纪念日待跟进，</span>
      <el-link style="font-size: 17px;margin-top: -6px" type="primary" @click="jump('myAfterSale',6)">
        点击处理
      </el-link>
    </div>

    <!-- 客户还款日提醒 -->
    <!-- todo: v-has-role="['after_sale']"  -->
    <div v-if="repaymentNum>0" style="padding-bottom: 20px">
      <span>您还有 {{ repaymentNum }} 位客户还款日待跟进，</span>
      <el-link style="font-size: 17px;margin-top: -6px" type="primary" @click="jump('myAfterSale',6)">
        点击处理
      </el-link>
    </div>

  </div>
</template>

<script>
import {getMessageTotal} from "@/api/lion/customerInfo";

export default {
  name: "Index",
  data() {
    return {
      // 售前被分配客户数量
      distNum: 0,
      // 售前转后期待处理数量
      loanToNum: 0,
      // 后期被分配客户数量
      loanNum: 0,
      // 后期转售后待处理数量
      afterToNum: 0,
      // 售后被分配客户数量
      afterNum: 0,
      // 客户生日、客户配偶生日、结婚纪念日提醒
      birthdayNum: 0,
      // 客户还款日提醒
      repaymentNum: 0

    }
  },
  created() {
    this.getMessageTotal();
  },
  methods: {
    getMessageTotal() {
      getMessageTotal().then(res => {
        this.distNum = res.distNum;
        this.loanToNum = res.loanToNum;
        this.loanNum = res.loanNum;
        this.afterToNum = res.afterToNum;
        this.afterNum = res.afterNum;
        this.birthdayNum = res.birthdayNum;
        this.repaymentNum = res.repaymentNum;
      });
    },
    /**
     * 页面跳转方法
     * @param layoutPath 跳转页面路由
     * @param reminderType  提醒类型
     * 1：售前被分配客户提醒
     * 2：售前转后期待处理提醒
     * 3：后期被分配客户提醒
     * 4：后期转售后待处理提醒
     * 5：售后被分配客户提醒
     * 6：客户生日、客户配偶生日、结婚纪念日提醒
     */
    jump(layoutPath, reminderType) {
      this.$router.push({path: layoutPath, query: {reminderType}})
    }

  }
};
</script>

<style scoped lang="scss">

</style>

